<template>
    <el-descriptions ref="ruleFormRef" :column="2" direction="vertical" v-loading="isLoading">
        <!-- <el-descriptions-item width="50%" :label='titles.id'>
			{{ isNullOrEmpty( formInline?.id ) }}
		</el-descriptions-item> -->
        <!-- <el-descriptions-item width="50%" :label='titles.projectId'>
			{{ isNullOrEmpty( formInline?.projectId ) }}
		</el-descriptions-item> -->
        <el-descriptions-item width="50%" :label='titles.facilitName'>
            {{ isNullOrEmpty(formInline?.facilitName) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.groupId'>
            {{ isNullOrEmpty(formInline?.groupName) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.position'>
            {{ isNullOrEmpty(formInline?.position == 1 ? '室内' : '室外') }}
        </el-descriptions-item>

        <el-descriptions-item width="50%" label='位置描述'>
            {{ isNullOrEmpty(formInline?.place) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.buildingId' v-if="formInline?.position == 1">
            {{ isNullOrEmpty(formInline?.buildingName) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.drawingId' v-if="formInline?.position == 1">
            {{ isNullOrEmpty(formInline?.drawingName) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.facilitSN'>
            {{ isNullOrEmpty(formInline?.facilitSN) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.faciltType'>
            {{ isNullOrEmpty(formInline?.FacilitType) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.dutyUid'>
            {{ isNullOrEmpty(formInline?.dutyName) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.outDate'>
            {{ isNullOrEmpty(formInline?.outDate) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.expireDate'>
            {{ isNullOrEmpty(formInline?.expireDate) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.fixDate'>
            {{ isNullOrEmpty(formInline?.fixDate) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.scrapDate'>
            {{ isNullOrEmpty(formInline?.scrapDate) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.mainteDate'>
            {{ isNullOrEmpty(formInline?.mainteDate) }}
        </el-descriptions-item>
        <el-descriptions-item width="50%" :label='titles.mainteCycle'>
            {{ isNullOrEmpty(formInline?.cycleValue) }}{{ formInline?.mainteCycle == 1 ? '周' : formInline?.mainteCycle
        == 2 ? '月' : '年'
            }}
        </el-descriptions-item>
        <!-- <el-descriptions-item width="50%" :label='titles.cycleValue'>
			{{ isNullOrEmpty( formInline?.cycleValue ) }}
		</el-descriptions-item> -->
        <el-descriptions-item width="50%" :label='titles.inspectionMode'>

            {{ isNullOrEmpty(formInline?.inspectionMode == 1 ? '不巡检' : formInline?.inspectionMode == 2 ? 'NFC巡检' :
        '二维码巡检') }}


        </el-descriptions-item>
        <el-descriptions-item v-if="formInline?.inspectionMode == 2" width="50%" :label='titles.NFC'>
            {{ isNullOrEmpty(formInline?.NFC) }}
        </el-descriptions-item>
        <el-descriptions-item v-if="formInline?.inspectionMode == 3" width="50%" :label='titles.QR'>
            {{ isNullOrEmpty(formInline?.QR) }}
        </el-descriptions-item>
        <el-descriptions-item v-if="formInline?.inspectionMode !== 1" width="50%" :label='titles.inspect'>

            <el-text v-for="(item, index) in formInline?.inspect">
                {{ isNullOrEmpty(item == 1 ? '拍照' : item == 2 ? '视频' : '') }}
            </el-text>
        </el-descriptions-item>
    </el-descriptions>
    <el-descriptions ref="ruleFormRef" :column="1" direction="vertical" v-loading="isLoading">
        <el-descriptions-item v-if="formInline?.inspectionMode !== 1" width="50%" :label='titles.inspectContent'>
            <el-text>
                {{ isNullOrEmpty(formInline?.inspectContent) }}
            </el-text>

        </el-descriptions-item>
    </el-descriptions>
    <el-descriptions ref="ruleFormRef" :column="1" direction="vertical" v-loading="isLoading">
        <el-descriptions-item width="50%" :label='titles.facilitImg'>
            <!-- {{ isNullOrEmpty( formInline?.facilitImg ) }} -->
            <el-image :preview-src-list="formInline?.facilitImg" :initial-index="index"
                class="w-[100px] h-[100px] mr-[20px]" v-for="(item, index) in formInline?.facilitImg" :src="item">
            </el-image>
        </el-descriptions-item>
    </el-descriptions>
</template>

<script setup lang="ts">
import { isNullOrEmpty } from '@/utils/functions'
import { ref } from "vue";
import type { infoType } from '@/api/operate/project-management/projectManagement/facility-management/index';
import { isEmpty } from "@pureadmin/utils";
type FormProps = {
    formInline: infoType,
    isLoading: boolean
}
const titles = {
    FacilitIcon: '设施图标',
    FacilitType: '设施类型',
    id: '编号',// id
    projectId: '',// projectId
    projectName: '所属项目',
    buildingName: '所属建筑',
    facilitName: '设施别名',// facilitName
    groupId: '设施分组',// groupId
    groupName: '所属分组',
    position: '位置类型',// position
    buildingId: '所在建筑',// buildingId
    drawingId: '所在楼层',// drawingId
    // insidePosition:'室内位置',
    // outsidePostion:'室外位置',
    place: '所在位置',
    drawingPoint: '图纸标记',// drawingPoints
    markPoint: '地图标记',// mapPoints
    facilitSN: '设施编号',// faciltSN
    faciltType: '设施类型',// faciltType
    dutyUid: '责任人',// dutyUid
    outDate: '出厂日期',// outDate
    expireDate: '过期时间',// expireDate
    fixDate: '安装时间',// fixDate
    scrapDate: '报废日期',// scrapDate
    mainteDate: '维保日期',// mainteDate
    mainteCycle: '维保周期',// mainteCycle
    cycleValue: '周期值',// cycleValue
    productId: '设施类型',
    inspectionMode: '巡检方式',// isInspection
    NFC: 'NFC编号',// NFC
    QR: '二维码编号',
    inspect: '巡检要求',// inspect
    inspectContent: '巡检内容',// inspectContent
    facilitImg: '设施照片',// facilitImg
    createdAt: '添加日期',
    action: '操作',
}
const props = withDefaults(defineProps<FormProps>(), {
    formInline: () => ({} as infoType),
    isLoading: false
});

const ruleFormRef = ref();
onMounted(() => {
})
function getRef() {
    return ruleFormRef.value;
}
defineExpose({ getRef });
</script>
